
-- 队列上传存档
-- 解决平台上传频繁后导致地图无法上传存档的问题

local cache = {}
local queue = {}

for i = 1, 16 do 
    cache[i] = { }
    queue[i] = { }
end 

function ac.player.__index:save_server_safe(name, value)
    local index = self:get_id()
    cache[index][name] = value
    if not queue[index][name] then 
        queue[index][name] = ac.wait(0, function()
            self:save_server(name, cache[index][name])
            queue[index][name] = nil
        end)
    end 
end 
